package com.kelvem.saas.workbanch.fsm.model;

import com.kelvem.saas.workbanch.fsm.entity.FsmEntity;
import com.kelvem.saas.workbanch.fsm.handle.Handle;
import lombok.Data;
import lombok.ToString;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

@Data
@ToString(exclude="clazzFullName")
public class EventNode implements Cloneable {

    protected String code;
    protected String name;
    protected String srcState;
    protected String dstState;

    protected String clazzSimpleName;
    protected String clazzFullName;
    protected String methodName;
    protected String entityName;
    protected Class<FsmEntity> entityClazz;
    
    protected String beanName;
    protected Object bean;
    protected Method method;
    
    protected List<String> srcStateList;
    
    protected List<Class<? extends Handle>> beforeHandleList = new ArrayList<>();
    protected List<Class<? extends Handle>> handleList = new ArrayList<>();
    protected List<Class<? extends Handle>> afterHandleList = new ArrayList<>();

    @Override
    public EventNode clone() {
        EventNode result = new EventNode();
        
        result.setCode(this.getCode());
        result.setName(this.getName());
        result.setSrcState(this.getSrcState());
        result.setDstState(this.getDstState());
        
        result.setClazzSimpleName(this.getClazzSimpleName());
        result.setClazzFullName(this.getClazzFullName());
        result.setMethodName(this.getMethodName());
        result.setEntityName(this.getEntityName());
        
        result.setBeanName(this.getBeanName());
        result.setBean(this.getBean());
        result.setMethod(this.getMethod());
        
        result.setSrcStateList(this.getSrcStateList());
        
        return result;
    }
}
